package com.bdqn.base.auth;

import com.bdqn.base.R;
import com.bdqn.pojo.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * IndexController
 *
 * @author LILIBO
 * @since 2023-02-22
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Resource
    private AuthServcie authServcie;

    @PostMapping("/login")
    public R login(@RequestBody(required = false) User user) {
        // 完成登录验证，并发放Token（令牌）
        String token = authServcie.login(user);
        return R.success(token);
    }

}
